# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
# Contributor: Jingbei Li <i@jingbei.li>

pkgname=intel-oneapi-dev-utilities
_pkgver=2021.8.0
_debpkgrel=25328
pkgver=${_pkgver}_${_debpkgrel}
pkgrel=2
pkgdesc="Intel oneAPI Dev Utilities"
arch=('loong64' 'x86_64')
url='https://software.intel.com/content/www/us/en/develop/tools/oneapi.html'
license=("custom")
source=("https://apt.repos.intel.com/oneapi/pool/main/${pkgname}-${_pkgver}-${_pkgver}-${_debpkgrel}_amd64.deb"
        "https://apt.repos.intel.com/oneapi/pool/main/${pkgname}-eclipse-cfg-${_pkgver}-${_debpkgrel}_all.deb")
b2sums=('8db5f5daddc2431a14687ec1c9e287988255279b328e0350a9d83d96036596b50b4e4dcda0adadca91ed483e43aa92490211766cf009807d880a99fe34248c1b'
        'ef7d61c69717f2457df9b23c1c5f9ba9518b7c6c4405268eda052131309b3e72e2f477cfe3badca7f74c22d69949c81dc56a43e5ef2220fa3b415ccedc408c82')
depends=('intel-oneapi-common')
provides=("${pkgname}-eclipse-cfg")
conflicts=('intel-oneapi-basekit')

noextract=(
	"${pkgname}-${_pkgver}-${_pkgver}-${_debpkgrel}_amd64.deb"
	"${pkgname}-eclipse-cfg-${_pkgver}-${_debpkgrel}_all.deb"
)

package() {
    cd "${srcdir}"
	ar x ${pkgname}-${_pkgver}-${_pkgver}-${_debpkgrel}_amd64.deb
    tar xvf data.tar.xz -C "${pkgdir}"
	rm data.tar.xz

	ar x ${pkgname}-eclipse-cfg-${_pkgver}-${_debpkgrel}_all.deb
    tar xvf data.tar.xz -C "${pkgdir}"
	rm data.tar.xz

    local _dev_path='/opt/intel/oneapi/dev-utilities'
    ln -s "${_dev_path}/${_pkgver}" "${pkgdir}/${_dev_path}/latest"

    install -d "${pkgdir}"/usr/share/licenses/"${pkgname}"
    ln -s /usr/share/licenses/intel-oneapi "${pkgdir}"/usr/share/licenses/"${pkgname}"/oneapi
}
